package com.morehair.controller.wx;

import com.morehair.bean.bo.wx.WxBaseReq;
import com.morehair.bean.pojo.Topic;
import com.morehair.bean.vo.admin.BaseRespVo;
import com.morehair.bean.vo.wx.WxBaseData;
import com.morehair.bean.vo.wx.WxTopicDetailVO;
import com.morehair.service.wx.WxTopicService;
import org.apache.ibatis.jdbc.Null;
import org.aspectj.apache.bcel.generic.RET;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: DLX
 * @Date: 2021/6/8 14:39
 * @Description:
 **/

@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService wxTopicService;

    @RequestMapping("list")
    public BaseRespVo wxTopicList(WxBaseReq wxBaseReq) {
        WxBaseData<Topic> wxTopicData = wxTopicService.query(wxBaseReq);

        return BaseRespVo.ok(wxTopicData);
    }

    @RequestMapping("detail")
    public BaseRespVo wxTopicDetail(Integer id) {
        WxTopicDetailVO wxTopicDetailVO = wxTopicService.getTopicDetail(id);
        return BaseRespVo.ok(wxTopicDetailVO);
    }

    @RequestMapping("related")
    public BaseRespVo wxTopicRelated(Integer id) {
        List<Topic> topicList = wxTopicService.getTopicRelated(id);
        return BaseRespVo.ok(topicList);
    }


}
